import math


class Solution:
    def numberOfRounds(self, startTime: str, finishTime: str) -> int:
        s1, s2 = startTime.split(":")
        s1, s2 = int(s1), int(s2)
        f1, f2 = finishTime.split(":")
        f1, f2 = int(f1), int(f2)

        if s1 > f1 or (s1 == f1 and s2 > f2):
            f1 += 24

        s = s1 * 60 + s2
        f = f1 * 60 + f2

        return max(0, math.floor(f / 15) - math.ceil(s / 15))


if __name__ == "__main__":
    print(Solution().numberOfRounds(startTime="12:01", finishTime="12:44"))  # 1
    print(Solution().numberOfRounds(startTime="20:00", finishTime="06:00"))  # 40
    print(Solution().numberOfRounds(startTime="00:00", finishTime="23:59"))  # 95
    print(Solution().numberOfRounds(startTime="00:47", finishTime="00:57"))  # 0
